package com.qph.base.model;

public class SystemContext {

	private static ThreadLocal<Integer> offset = new ThreadLocal<Integer>();
	private static ThreadLocal<Integer> pagesize = new ThreadLocal<Integer>();
	private static ThreadLocal<Integer> total = new ThreadLocal<Integer>();
	private static ThreadLocal<String> sort = new ThreadLocal<String>();
	private static ThreadLocal<String> order = new ThreadLocal<String>();

	public static int getOffset() {
		Integer os = (Integer) offset.get();
		if (os == null) {
			return 0;
		}
		return os;
	}

	public static void setOffset(int offsetvalue) {
		offset.set(offsetvalue);
	}

	public static void removeOffset() {
		offset.remove();
	}

	public static int getPagesize() {
		Integer ps = (Integer) pagesize.get();
		if (ps == null) {
			return Integer.MAX_VALUE;
		}
		return ps;
	}

	public static void setPagesize(int pagesizevalue) {
		pagesize.set(pagesizevalue);
	}

	public static void removePagesize() {
		pagesize.remove();
	}
	
	public static void setTotal(int tatalV) {
		total.set(tatalV);
	}

	public static void removeTotal() {
		total.remove();
	}

	public static int getTotal(){
		return total.get();
	}
	
	public static void setSort(String sortName) {
		sort.set(sortName);
	}
	public static void removeSort() {
		sort.remove();
	}
	public static void removeOrder() {
		order.remove();
	}
	
	public static String getSort(){
		return sort.get();
	}
	
	public static String getOrder(){
		return order.get();
	}
	
	public static void setOrder(String o) {
		order.set(o);
	}
}
